package com.abel.bigwater

import com.abel.bigwater.mapper.DataMapper
import com.abel.bigwater.mapper.MeterMapper
import org.junit.Test
import org.junit.runner.RunWith
import org.mybatis.spring.annotation.MapperScan
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.junit4.SpringRunner

@SpringBootTest(classes = [MapperTest::class])
@RunWith(SpringRunner::class)
@ComponentScan(basePackages = ["com.abel.bigwater"])
@MapperScan(basePackages = ["com.abel.bigwater.mapper"])
class MapperTest {
    @Autowired
    var dataMapper: DataMapper? = null

    @Autowired
    var meterMapper: MeterMapper? = null

    @Test
    fun testMeterBrand() {
        val lst = meterMapper!!.selectMeterBrand()
        lgr.info("brand list: ${lst.joinToString()}")

        val rlist = meterMapper!!.selectRemoteBrand()
        lgr.info("remote list: ${rlist.joinToString()}")
    }

    companion object {
        private val lgr = LoggerFactory.getLogger(MapperTest::class.java)
    }
}